<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class DeviceRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [

            'device_no'         => 'required|string',
            'factory_id'        => 'required|integer',
            'device_model'      => '',
            'iccid'             => '',
            'cpuid'             => '',
            'version'           => '',
        ];
    }

    /**
     * @return string[]
     */
    public function messages()
    {
        return [
            'device_no.required'    => '设备编号不能为空',
            'factory_id.required'   => '厂家不能为空',
            'device_model.required' => '设备型号不能为空',
            'iccid.required'        => '物联网卡号不能为空',
            'cpuid.required'        => '模组编号不能为空',
            'version.required'      => '内核版本号不能为空',
        ];
    }
}
